package io.renren.modules.usian.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.usian.dao.TeacherDao;
import io.renren.modules.usian.entity.TeacherEntity;
import io.renren.modules.usian.service.TeacherService;


@Service("teacherService")
public class TeacherServiceImpl extends ServiceImpl<TeacherDao, TeacherEntity> implements TeacherService {

    @Autowired
    private TeacherDao teacherDao;


    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TeacherEntity> page = this.page(
                new Query<TeacherEntity>().getPage(params),
                new QueryWrapper<TeacherEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<TeacherEntity> showListByCid(int cid,int role) {
        LambdaQueryWrapper<TeacherEntity> lambdaQueryWrapper=new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(TeacherEntity::getCId,cid);
        // 项目经理
lambdaQueryWrapper.eq(TeacherEntity::getRole,role);
lambdaQueryWrapper.eq(TeacherEntity::getStatus,0);
        List<TeacherEntity> list = teacherDao.selectList(lambdaQueryWrapper);

        return list;
    }


}